/**
 * OWASP GoatDroid Project
 * 
 * This file is part of the Open Web Application Security Project (OWASP)
 * GoatDroid project. For details, please see
 * https://www.owasp.org/index.php/Projects/OWASP_GoatDroid_Project
 *
 * Copyright (c) 2011 - The OWASP Foundation
 * 
 * GoatDroid is published by OWASP under the GPLv3 license. You should read and accept the
 * LICENSE before you use, modify, and/or redistribute this software.
 * 
 * @author Jack Mannino, nVisium Security (https://www.nvisiumsecurity.com)
 * @created 2011
 */
package org.owasp.goatdroid.fourgoats.webservice.resources;

import javax.ws.rs.CookieParam;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import org.owasp.goatdroid.fourgoats.webservice.Constants;
import org.owasp.goatdroid.fourgoats.webservice.login.LoginBean;
import org.owasp.goatdroid.fourgoats.webservice.login.LoginImpl;

@Path("/fourgoats/api/v1/login")
public class Login {

	@Path("authenticate")
	@GET
	@Produces("application/json")
	public LoginBean validateCredentials(
			@QueryParam("userName") String userName,
			@QueryParam("password") String password)
			throws WebApplicationException {

		return LoginImpl.validateCredentials(userName, password);
	}

	@Path("check_session")
	@GET
	@Produces("application/json")
	public LoginBean checkSession(
			@CookieParam(Constants.SESSION_TOKEN_NAME) String sessionToken) {

		return LoginImpl.checkSession(sessionToken);
	}

	@Path("sign_out")
	@GET
	@Produces("application/json")
	public LoginBean signOut(
			@CookieParam(Constants.SESSION_TOKEN_NAME) String sessionToken) {

		return LoginImpl.signOut(sessionToken);
	}

}
